package baiqi.sishen.community.config;

import baiqi.sishen.community.interceptor.SessionInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author 兕神
 * @version 1.0
 * DateTime: 2023/4/28
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private SessionInterceptor sessionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //对所有的资源进行拦截，进行登录检验
        registry.addInterceptor(sessionInterceptor).addPathPatterns("/**");
    }
}
